package com.example.reference_book.filter.courseBookImpl;


import com.example.reference_book.entity.CourseBookInfo;
import com.example.reference_book.filter.CourseBookFilter;

import java.util.ArrayList;
import java.util.List;

public class CourseBookBookFilter implements CourseBookFilter {
    @Override
    public List<CourseBookInfo> getList(String key, List<CourseBookInfo> list) {
        List<CourseBookInfo> res = new ArrayList<>();
        for (CourseBookInfo courseBookInfo : list) {
            if (courseBookInfo.getBookName().contains(key)) {
                res.add(courseBookInfo);
            }
        }
        return res;
    }

}
